CREATE TABLE [dbo].[Rules]
(
[Id] [int] NOT NULL IDENTITY(1, 1),
[TransactionAmount] [decimal] (18, 0) NULL,
[AccountId] [int] NULL,
[TransactionTypeId] [int] NULL,
[TransactionRoleId] [int] NULL,
[NumberofTransactions] [int] NULL,
[WindowPeriodInHours] [int] NULL,
[MaxBalance] [decimal] (18, 0) NULL,
[MinBalance] [decimal] (18, 0) NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Rules] ADD CONSTRAINT [PK_Rule] PRIMARY KEY CLUSTERED  ([Id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Rules] ADD CONSTRAINT [FK_Rule_Account] FOREIGN KEY ([AccountId]) REFERENCES [dbo].[Accounts] ([Id])
GO
ALTER TABLE [dbo].[Rules] ADD CONSTRAINT [FK_Rule_Rule] FOREIGN KEY ([TransactionRoleId]) REFERENCES [dbo].[TransactionRoles] ([Id])
GO
ALTER TABLE [dbo].[Rules] ADD CONSTRAINT [FK_Rule_TransactionTypes] FOREIGN KEY ([TransactionTypeId]) REFERENCES [dbo].[TransactionTypes] ([Id])
GO
